// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SelectorHelper.cs" company="Marcin Jastrzebski">
//   Copyright (c) Marcin Jastrzebski (marcin@marcinj.net)
// </copyright>
// <summary>
//   Allows selectors to pick the right mapping.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace mPassRT.Selectors
{
    using System.Collections.Generic;
    using System.Linq;

    /// <summary>Allows selectors to pick the right mapping.</summary>
    internal static class SelectorHelper
    {
        #region Public Methods and Operators

        /// <summary>Gets the mapping.</summary>
        /// <param name="item">The item.</param>
        /// <param name="mappings">The mappings.</param>
        /// <returns>The <see cref="BaseSelectorMapping"/>.</returns>
        public static BaseSelectorMapping GetMapping(object item, IEnumerable<BaseSelectorMapping> mappings)
        {
            return mappings.FirstOrDefault(m => m.TypeName == item.GetType().Name);
        }

        #endregion
    }
}